import os, sys, shelve, collections, xmlrpclib, time, datetime
import cPickle as pickle
from SimpleXMLRPCServer import SimpleXMLRPCServer
import zlib


EM_PORT = 8000


def exp_from_data(data):
	return pickle.loads(zlib.decompress(data))
	
def data_from_exp(exp):
	return zlib.compress(pickle.dumps(exp), 8)
	
def load_defaults():
	home_path = os.path.join(os.getenv('HOME'), '.bourbon')
	if os.path.exists(home_path):
		# read the binding from the file
		data = {}
		execfile(home_path, data)
		return data
	return {}